Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fix unit test ci failure #246

Merged
merged 1 commit into from
Jul 31, 2024

Conversation

SuZhou-Joe
Copy link
Member

@SuZhou-Joe SuZhou-Joe commented Jul 31, 2024

Description

SyntaxError: Cannot use import statement outside a module

      31 | /* eslint-disable @osd/eslint/module_migration */
      32 |
    > 33 | import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
         | ^
      34 |
      35 | import 'monaco-editor/esm/vs/base/common/worker/simpleWorker';
      36 | import 'monaco-editor/esm/vs/base/worker/defaultWorkerFactory';

      at Runtime.createScriptFromCode (../../node_modules/jest-runtime/build/index.js:1728:14)
      at Object.<anonymous> (../../packages/osd-monaco/src/monaco.ts:33:1)
      at Object.<anonymous> (../../packages/osd-monaco/src/index.ts:31:1)
      at Object.<anonymous> (../../src/plugins/data/public/antlr/opensearch_sql/code_completion.ts:6:1)
      at Object.<anonymous> (../../src/plugins/data/public/plugin.ts:96:1)
      at Object.<anonymous> (../../src/plugins/data/public/index.ts:503:1)
      at Object.<anonymous> (../../src/plugins/saved_objects/public/saved_object/helpers/serialize_saved_object.ts:34:1)
      at Object.<anonymous> (../../src/plugins/saved_objects/public/saved_object/helpers/build_saved_object.ts:34:1)
      at Object.<anonymous> (../../src/plugins/saved_objects/public/saved_object/saved_object.ts:42:1)
      at Object.<anonymous> (../../src/plugins/saved_objects/public/saved_object/index.ts:31:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        3.359 s

Embeddable plugin are introducing monaco editor and that breaks the CI of assistant. This PR is trying to fix that by only importing the viewMode from core by doing an intercept.

Making jest transform the node_modules/monaco-editor should work as well.

But the approach in this PR won't compile unnecessary modules when doing unit test.

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test.
  • New functionality has user manual doc added.
  • Commits are signed per the DCO using --signoff.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: SuZhou-Joe <[email protected]>
Copy link
Collaborator

@Hailong-am Hailong-am left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

@SuZhou-Joe SuZhou-Joe added backport 2.x Trigger the backport flow to 2.x backport 2.16 labels Jul 31, 2024
@SuZhou-Joe SuZhou-Joe merged commit d94b896 into opensearch-project:main Jul 31, 2024
17 of 28 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 31, 2024
Signed-off-by: SuZhou-Joe <[email protected]>
(cherry picked from commit d94b896)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jul 31, 2024
Signed-off-by: SuZhou-Joe <[email protected]>
(cherry picked from commit d94b896)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Jul 31, 2024
(cherry picked from commit d94b896)

Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Jul 31, 2024
(cherry picked from commit d94b896)

Signed-off-by: SuZhou-Joe <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Trigger the backport flow to 2.x backport 2.16 Skip-Changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants